﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;

using ProjectBase.Core;

namespace $safeprojectname$.Converter
{
    public class NumberToWordConverterCs : NumberToWordConverter
    {
        protected override string GetOnes(int count, NumberType? numberType = null)
        {
            switch (count)
            {
                case 1:
                    if (numberType.HasValue)
                    {
                        switch (numberType)
                        {
                            case NumberType.Hundred:
                                return Separator + "jedno";
                            case NumberType.Thousand:
                                return Separator + "jeden";
                            case NumberType.Million:
                                return Separator + "jeden";
                        }
                    }
                    return Separator + "jedna";
                case 2:
                    if (numberType.HasValue)
                    {
                        switch (numberType)
                        {
                            case NumberType.Hundred:
                                return Separator + "dvě";
                            case NumberType.Billion:
                                return Separator + "dvě";
                        }
                    }
                    return Separator + "dva";
                case 3:
                    return Separator + "tři";
                case 4:
                    return Separator + "čtyři";
                case 5:
                    return Separator + "pět";
                case 6:
                    return Separator + "šest";
                case 7:
                    return Separator + "sedm";
                case 8:
                    return Separator + "osm";
                case 9:
                    return Separator + "devět";
            }
            return string.Empty;
        }
        protected override string GetTens(int count, NumberType? numberType = null)
        {
            if (count <= 9)
            {
                return GetOnes(count, numberType);
            }
            switch (count)
            {
                case 10:
                    return Separator + "deset";
                case 11:
                    return Separator + "jedenáct";
                case 12:
                    return Separator + "dvanáct";
                case 13:
                    return Separator + "třináct";
                case 14:
                    return Separator + "čtrnáct";
                case 15:
                    return Separator + "patnáct";
                case 16:
                    return Separator + "šestnáct";
                case 17:
                    return Separator + "sedmnáct";
                case 18:
                    return Separator + "osmnáct";
                case 19:
                    return Separator + "devatenáct";
            }

            int remainder;
            var result = Math.DivRem(count, 10, out remainder);


            switch (result)
            {
                case 2:
                    return Separator + "dvacet" + GetOnes(remainder);
                case 3:
                    return Separator + "třicet" + GetOnes(remainder);
                case 4:
                    return Separator + "čtyřicet" + GetOnes(remainder);
                case 5:
                    return Separator + "padesát" + GetOnes(remainder);
                case 6:
                    return Separator + "šedesát" + GetOnes(remainder);
                case 7:
                    return Separator + "sedmdesát" + GetOnes(remainder);
                case 8:
                    return Separator + "osmdesát" + GetOnes(remainder);
                case 9:
                    return Separator + "devadesát" + GetOnes(remainder);
            }
            return string.Empty;
        }
        protected override string GetHundreds(int count)
        {
            if (count == 0)
            {
                return string.Empty;
            }

            switch (count)
            {
                case 1:
                    return GetOnes(count, NumberType.Hundred) + Separator + "sto";
                case 2:
                    return GetOnes(count, NumberType.Hundred) + Separator + "stě";
                case 3:
                    return GetOnes(count, NumberType.Hundred) + Separator + "sta";
                case 4:
                    return GetOnes(count, NumberType.Hundred) + Separator + "sta";
                default:
                    return GetOnes(count, NumberType.Hundred) + Separator + "set";
            }
        }
        protected override string GetBillions(int count)
        {
            if (count == 0)
            {
                return string.Empty;
            }

            int remainder;
            Math.DivRem(count, 100, out remainder);

            switch (remainder)
            {
                case 1:
                    return Separator + "miliarda";
                case 2:
                    return Separator + "miliardy";
                case 3:
                    return Separator + "miliardy";
                case 4:
                    return Separator + "miliardy";
                default:
                    return Separator + "miliard";
            }
        }
        protected override string GetMillions(int count)
        {
            if (count == 0)
            {
                return string.Empty;
            }
            int remainder;
            Math.DivRem(count, 100, out remainder);

            switch (remainder)
            {
                case 1:
                    return Separator + "milion";
                case 2:
                    return Separator + "miliony";
                case 3:
                    return Separator + "miliony";
                case 4:
                    return Separator + "miliony";
                default:
                    return Separator + "milionů";
            }
        }
        protected override string GetThousands(int count)
        {
            if (count == 0)
            {
                return string.Empty;
            }

            int remainder;
            Math.DivRem(count, 100, out remainder);

            switch (remainder)
            {
                case 1:
                    return Separator + "tisíc";
                case 2:
                    return Separator + "tisíce";
                case 3:
                    return Separator + "tisíce";
                case 4:
                    return Separator + "tisíce";
                default:
                    return Separator + "tisíc";
            }
        }
    }
}